home *** CD-ROM | disk | FTP | other *** search
/ QuickTime VR Showcase / QuickTime VR Showcase.iso / media / reference / tesbed cast / 00049_Script_49 < prev    next >
Encoding:
Text File  |  1996-12-13  |  27.7 KB  |  736 lines

  1.  
  2. -- © 1992-1995 Apple Computer, Inc.  All rights reserved.
  3.  
  4. --=============================================================================
  5. -- Routines for initializing and cleaning up the Director movie.
  6. -------------------------------------------------------------------------------
  7.  
  8.  
  9. --=============================================================================
  10. -- StartMovie
  11. --
  12. -- Runs at movie start time.  Initializes key globals, opens the external code
  13. -- library, registers the QuickTime VR components, and sets up the XCMD Callback
  14. -- Factory.
  15. -------------------------------------------------------------------------------
  16. on StartMovie
  17.   global gPanoMovieID, gNavMovieID, gPathName, gLastTimeRollover, gPanoFrame
  18.   put empty into gPanoMovieID
  19.   put empty into gNavMovieID
  20.   put empty into gPathName
  21.   put false into gLastTimeRollover
  22.   put empty into gPanoFrame
  23.   
  24.   -- Need to open up the external xlib so that we don't have the
  25.   -- XCMD floating-point bug problem when we save.
  26.   -- This would be commented out just before we turn this into a projector.
  27.   
  28.   openxlib "QuickTime VR XCMDs"
  29.   
  30.   -- Register the QuickTime VR component
  31.   -- This would turn into RegisterComponent (":", empty) when the components are
  32.   -- embedded in the projector.
  33.   
  34.   RegisterComponent (the pathname & "QuickTime VR Components", empty)
  35.   
  36.   -- Need to set up the XCMD Callback Factory so that we can execute callbacks
  37.   -- to Lingo handlers from PanoMovie
  38.   
  39.   global gQTVRCallBackFactory
  40.   put CallBackTracer(mNew) into gQTVRCallBackFactory
  41.   SetCallBack PanoMovie,gQTVRCallBackFactory
  42. end StartMovie
  43.  
  44.  
  45. --=============================================================================
  46. -- StopMovie
  47. --
  48. -- Runs at movie stop time.  Closes any open pano or nav movies.  Disposes
  49. -- of the XCMD Callback Factory and closes the external code library.
  50. -------------------------------------------------------------------------------
  51. on StopMovie
  52.   -- Close any open panoramic or object movies
  53.   ClosePanoMovie
  54.   CloseNavMovie
  55.   
  56.   -- Close the external XCMD library
  57.   -- This would be commented out just before we turn this into a projector.
  58.   
  59.   closexlib "QuickTime VR XCMDs"
  60.   
  61.   -- Dispose of the XCMD Callback Factory
  62.   global gQTVRCallBackFactory
  63.   if objectP(gQTVRCallBackFactory) then gQTVRCallBackFactory (mDispose)
  64. end StopMovie
  65.  
  66.  
  67. --=============================================================================
  68. -- Routines for managing navigable movies
  69. -------------------------------------------------------------------------------
  70.  
  71.  
  72. --=============================================================================
  73. -- OpenNavMovie:
  74. --      pFilename is the full file path of the file
  75. --      pSpriteNum is the sprite associated with the direct Nav Movie
  76. --      pShowOnOpen is a boolean for showing the movie on screen immediately
  77. --
  78. -- Opens the file pFileName as a nav movie at the top left corner of sprite
  79. -- pSpriteNum.  Shows it on the screen as dictated by pShowOnOpen.
  80. -------------------------------------------------------------------------------
  81. on OpenNavMovie pFilename, pSpriteNum, pShowOnOpen
  82.   global gNavMovieID
  83.   
  84.   -- The use of a single global gNavMovieID constrains these routines 
  85.   -- to only allow one pano movie to be open at a time.
  86.   -- Close any other open nav movie.
  87.   CloseNavMovie
  88.   
  89.   -- Load in the movie.  Assume the underlying sprite is the correct size.
  90.   put NavMovie ("openMovie", "Direct", pFilename ,¨
  91.                 the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum, ¨
  92.                 "ShowPoster", "Invisible") into gNavMovieID
  93.   if gNavMovieID contains "error" then 
  94.     put gNavMovieID
  95.     put empty into gNavMovieID
  96.     beep
  97.     exit
  98.   end if
  99.   
  100.   if pShowOnOpen then
  101.     -- Show the poster frame of the nav movie on screen
  102.     NavMovie "Direct", gNavMovieID, "update"
  103.   end if
  104. end OpenNavMovie
  105.  
  106.  
  107. --=============================================================================
  108. -- ShowNavMovie
  109. --
  110. -- Updates the nav movie display on screen.
  111. -------------------------------------------------------------------------------
  112. on ShowNavMovie
  113.   global gNavMovieID
  114.   if gNavMovieID <> empty then
  115.     NavMovie "Direct", gNavMovieID, "update"
  116.   end if
  117. end ShowNavMovie
  118.  
  119.  
  120. --=============================================================================
  121. -- ZoomNavMovie:
  122. --      pStartZoomRect specifies the start rect as a string rect
  123. --      [pSkipFirstFrame] is "true" if the first zoom frame should not be shown
  124. --      [pClipRect] is the screen string rect to which the zoom should be clipped
  125. --
  126. -- Zooms the nav movie out from the start rect specified, possibly skipping
  127. -- the first frame and clipping to a given rect.
  128. -------------------------------------------------------------------------------
  129. on ZoomNavMovie pStartZoomRect, pSkipFirstFrame, pClipRect
  130.   global gNavMovieID
  131.   if gNavMovieID <> empty then
  132.     put "ZoomOutMovie" && quote & pStartZoomRect & quote into tCommand
  133.     if not voidP(pSkipFirstFrame) then
  134.       put tCommand & "," & pSkipFirstFrame into tCommand
  135.     end if
  136.     if not voidP(pClipRect) then
  137.       put tCommand & "," & quote & pClipRect & quote into tCommand
  138.     end if  
  139.     NavMovie "Direct", gNavMovieID, tCommand
  140.     -- Send an idle so that if MoviesTask() is called, we don't get a
  141.     -- spurious update
  142.     NavMovie "Direct", gNavMovieID, "idle"
  143.   end if
  144. end ZoomNavMovie
  145.  
  146.  
  147. --=============================================================================
  148. -- SetNavMovieView:
  149. --      pHPan is the horizontal pan angle
  150. --      pVPan is the vertical pan angle
  151. --
  152. -- Sets the nav movie view to the specified pan angles.
  153. -------------------------------------------------------------------------------
  154. on SetNavMovieView pHPan, pVPan
  155.   global gNavMovieID
  156.   if gNavMovieID <> empty then
  157.     NavMovie "Direct", gNavMovieID, "set", "hPanAngle", pHPan
  158.     NavMovie "Direct", gNavMovieID, "set", "vPanAngle", pVPan
  159.   end if
  160. end SetNavMovieView
  161.  
  162.  
  163. --=============================================================================
  164. -- CloseNavMovie
  165. --
  166. -- Disposes an open nav movie.  This does not remove the image from
  167. -- the screen.
  168. -------------------------------------------------------------------------------
  169. on CloseNavMovie
  170.   global gNavMovieID
  171.   if gNavMovieID <> empty then
  172.     NavMovie "Direct", gNavMovieID, "dispose"
  173.     put empty into gNavMovieID
  174.   end if 
  175. end CloseNavMovie
  176.  
  177.  
  178. --=============================================================================
  179. -- NavFrameScript
  180. --      pSpriteNum is the sprite which lies under the nav movie
  181. --
  182. -- When run frequently, provides cursor feedback over the nav movie
  183. -- and handles mouse down and keyboard actions.
  184. -------------------------------------------------------------------------------
  185. on NavFrameScript pSpriteNum
  186.   global gNavMovieID
  187.   if gNavMovieID <> empty and RunningInForeground() = "true" then 
  188.     if rollover (pSpriteNum) then
  189.       NavMovie "Direct", gNavMovieID, "mouseOver"
  190.       
  191.       -- Set the cursor twice because Director tries to be smart and
  192.       -- doesn't change the cursor if your current cursor command
  193.       -- is the same as the last one.  It doesn't realize of course,
  194.       -- that QTVR has changed the cursor in between.
  195.       
  196.       -- KNOWN BUG: It appears that the cursor command is ignored if the mouse
  197.       -- is not over the stage, so if you move out of the movie window
  198.       -- fast enough and off the stage, the cursor will remain unchanged.
  199.       
  200.       cursor 200
  201.       cursor -1
  202.     else
  203.       NavMovie "Direct", gNavMovieID, "idle"
  204.     end if
  205.   end if
  206. end NavFrameScript
  207.  
  208.  
  209. --=============================================================================
  210. -- Routines for managing panoramic movies
  211. -------------------------------------------------------------------------------
  212.  
  213.  
  214. --=============================================================================
  215. -- OpenPanoMovie
  216. --      pFilename is the full file path of the file
  217. --      pSpriteNum is the sprite associated with the direct Pano Movie
  218. --      pShowOnOpen is a boolean for showing the movie on screen immediately
  219. --
  220. -- Opens the file pFileName as a panoramic movie, and sets up callback
  221. -- handlers as specified.  Updates the screen with the movie's default
  222. -- view if requested by pShowOnOpen
  223. -------------------------------------------------------------------------------
  224. on OpenPanoMovie pFileName, pSpriteNum, pShowOnOpen
  225.   global gPanoMovieID, gPathName
  226.   
  227.   -- The use of a single global gPanoMovieID constrains these routines 
  228.   -- to only allow one pano movie to be open at a time.
  229.   -- Close any other open pano movie.
  230.   ClosePanoMovie
  231.   
  232.   -- Make the pano movie display in the rect covered by sprite pSpriteNum
  233.   put the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," &¨
  234. the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum into tPanoRect
  235.   
  236.   put PanoMovie("openMovie", "Direct", pFileName, tPanoRect) into gPanoMovieID
  237.   if gPanoMovieID contains "error" then
  238.     -- Display the error in the message window
  239.     put gPanoMovieID
  240.     put empty into gPanoMovieID
  241.     beep
  242.     exit
  243.   end if 
  244.   
  245.   put ExtractPathName(pFileName) into gPathName
  246.   
  247.   InitPanoCallbacks
  248.   
  249.   if pShowOnOpen then
  250.     PanoMovie "Direct", gPanoMovieID, "update"
  251.   end if
  252.   
  253. end OpenPanoMovie
  254.  
  255.  
  256. --=============================================================================
  257. -- InitPanoCallbacks
  258. --
  259. -- Initializes the callbacks used for panoramic movies.
  260. -------------------------------------------------------------------------------
  261. on InitPanoCallbacks
  262.   global gPanoMovieID
  263.   if gPanoMovieID <> empty then
  264.     -- Set up callback handlers for panoramic movies.  
  265.     
  266.     -- We reset each callback to empty if we're not setting it to a handler name;
  267.     -- this resets callbacks which may have been set in the Pano Callbacks frames.
  268.     -- The default value for each callback property is empty.
  269.     
  270.     PanoMovie "Direct", gPanoMovieID, "set", "mouseOverHandler", empty
  271.     -- PanoMovie "Direct", gPanoMovieID, "set", "mouseOverHandler", "sampleMouseOverHandler"
  272.     
  273.     -- PanoMovie "Direct", gPanoMovieID, "set", "rolloverHotSpotHandler", empty
  274.     PanoMovie "Direct", gPanoMovieID, "set", "rolloverHotSpotHandler", "sampleRolloverHandler"
  275.     
  276.     PanoMovie "Direct", gPanoMovieID, "set", "mouseDownHandler", empty
  277.     -- PanoMovie "Direct", gPanoMovieID, "set", "mouseDownHandler", "sampleMouseDownHandler"
  278.     
  279.     PanoMovie "Direct", gPanoMovieID, "set", "panZoomStartHandler", empty
  280.     -- PanoMovie "Direct", gPanoMovieID, "set", "panZoomStartHandler", "samplePanZoomStartHandler"
  281.     
  282.     PanoMovie "Direct", gPanoMovieID, "set", "mouseStillDownHandler", empty
  283.     -- PanoMovie "Direct", gPanoMovieID, "set", "mouseStillDownHandler", "sampleMouseStillDownHandler"
  284.     
  285.     PanoMovie "Direct", gPanoMovieID, "set", "nodeLeaveHandler", empty
  286.     -- PanoMovie "Direct", gPanoMovieID, "set", "nodeLeaveHandler", "sampleNodeLeaveHandler"
  287.   end if
  288. end InitPanoCallbacks
  289.  
  290.  
  291.  
  292. --=============================================================================
  293. -- ShowPanoMovie
  294. --      [pQuality] is the quality level at which to display the update
  295. --
  296. -- Updates the pano movie display.  Has the side effect of changing
  297. -- the current quality level to pQuality, if specified.
  298. -------------------------------------------------------------------------------
  299. on ShowPanoMovie pQuality
  300.   global gPanoMovieID
  301.   if gPanoMovieID <> empty then
  302.     if not voidP(pQuality) then PanoMovie "Direct", gPanoMovieID, "set", "quality", pQuality 
  303.     PanoMovie "Direct", gPanoMovieID, "update"
  304.   end if
  305. end ShowPanoMovie
  306.  
  307.  
  308. --=============================================================================
  309. -- SetPanoNode
  310. --      pNodeID is the number of the node to go to
  311. --      pUpdate is true if a screen update is to be performed
  312. --      [pQuality] is the quality level at which to display the update
  313. --
  314. -- Changes the current node as specified.  If pUpdate is true, updates the
  315. -- screen to reflect that node's default view.  Has the side effect of changing
  316. -- the current quality level to pQuality, if specified.
  317. -------------------------------------------------------------------------------
  318. on SetPanoNode pNodeID, pUpdate, pQuality
  319.   global gPanoMovieID
  320.   if gPanoMovieID <> empty then
  321.     PanoMovie "Direct", gPanoMovieID, "set", "nodeID", pNodeID
  322.     if not voidP(pQuality) then PanoMovie "Direct", gPanoMovieID, "set", "quality", pQuality 
  323.     if pUpdate then PanoMovie "Direct", gPanoMovieID, "Update" 
  324.   end if
  325. end SetPanoNode
  326.  
  327.  
  328. --=============================================================================
  329. -- SwingPanoMovie
  330. --      pHPan is the destination horizontal pan angle
  331. --      pVPan is the destination vertical pan angle
  332. --      pZoom is the destination zoom angle
  333. --      pSwingSpeed is the speed at which to swing
  334. --      pSwingQuality is the quality at which to swing
  335. --      pFinalQuality is the quality at which to re-update the destination view
  336. --
  337. -- Swings the view around to a specified direction.  Has the side effect of
  338. -- changing the current quality level to pFinalQuality
  339. -------------------------------------------------------------------------------
  340. on SwingPanoMovie pHPan, pVPan, pZoom, pSwingSpeed, pSwingQuality, pFinalQuality
  341.   global gPanoMovieID
  342.   if gPanoMovieID <> empty then
  343.     -- Set up the destination pan and zoom angles
  344.     PanoMovie "Direct", gPanoMovieID, "set", "zoomAngle", pZoom 
  345.     PanoMovie "Direct", gPanoMovieID, "set", "vPanAngle", pVPan
  346.     PanoMovie "Direct", gPanoMovieID, "set", "hPanAngle", pHPan 
  347.     
  348.     -- For performance, you can use lower quality during the swing
  349.     PanoMovie "Direct", gPanoMovieID, "set", "quality", pSwingQuality
  350.     PanoMovie "Direct", gPanoMovieID, "set", "transitionMode", "swing" 
  351.     PanoMovie "Direct", gPanoMovieID, "set", "transitionSpeed", pSwingSpeed
  352.     PanoMovie "Direct", gPanoMovieID, "update"
  353.     
  354.     -- Set transition mode to normal
  355.     PanoMovie "Direct", gPanoMovieID, "set", "transitionMode", "normal"
  356.     
  357.     -- Only do a reupdate if the quality values are different
  358.     if pFinalQuality <> pSwingQuality then
  359.       PanoMovie "Direct", gPanoMovieID, "set", "quality", pFinalQuality 
  360.       PanoMovie "Direct", gPanoMovieID, "update" 
  361.     end if
  362.   end if
  363. end SwingPanoMovie
  364.  
  365.  
  366. --=============================================================================
  367. -- CollapsePanoMovie
  368. --
  369. -- Collapses to the currently selected hot spot.
  370. -------------------------------------------------------------------------------
  371. on CollapsePanoMovie
  372.   global gPanoMovieID
  373.   if gPanoMovieID <> empty then
  374.     PanoMovie "Direct", gPanoMovieID, "CollapseToHotSpotRgn"
  375.   end if
  376. end CollapsePanoMovie
  377.  
  378.  
  379. --=============================================================================
  380. -- SetPanoMovieView
  381. --      pHPan is the destination horizontal pan angle
  382. --      pVPan is the destination vertical pan angle
  383. --      pZoom is the destination zoom angle
  384. --      [pQuality] is the quality at which to display the view
  385. --
  386. -- Displays a new view in the current node.  Has the side effect of changing
  387. -- the current quality level to pQuality, if specified.
  388. -------------------------------------------------------------------------------
  389. on SetPanoMovieView pHPan, pVPan, pZoom, pQuality
  390.   global gPanoMovieID
  391.   if gPanoMovieID <> empty then
  392.     PanoMovie "Direct", gPanoMovieID, "set", "zoomAngle", pZoom
  393.     PanoMovie "Direct", gPanoMovieID, "set", "vPanAngle", pVPan
  394.     PanoMovie "Direct", gPanoMovieID, "set", "hPanAngle", pHPan
  395.     if not voidP(pQuality) then PanoMovie "Direct", gPanoMovieID, "set", "quality", pQuality 
  396.     PanoMovie "Direct", gPanoMovieID, "update"
  397.   end if
  398. end SetPanoMovieView
  399.  
  400.  
  401. --=============================================================================
  402. -- ClosePanoMovie
  403. --
  404. -- Disposes an open pano movie.  This does not remove the image from
  405. -- the screen.
  406. -------------------------------------------------------------------------------
  407. on ClosePanoMovie
  408.   global gPanoMovieID
  409.   if gPanoMovieID <> empty then
  410.     PanoMovie "Direct", gPanoMovieID, "dispose"
  411.     put empty into gPanoMovieID
  412.   end if
  413. end ClosePanoMovie
  414.  
  415.  
  416.  
  417. --=============================================================================
  418. -- PanoFrameScript
  419. --
  420. -- When run frequently, provides cursor feedback over the pano movie
  421. -- and handles mouse down and keyboard actions.
  422. -------------------------------------------------------------------------------
  423. on PanoFrameScript pSpriteNum
  424.   global gLastTimeRollover
  425.   if rollover(pSpriteNum) then
  426.     global gPanoMovieID
  427.     
  428.     -- Only run mouseOver if there's a movie AND Director is in the foreground
  429.     if gPanoMovieID <> empty and RunningInForeground() = "true" then 
  430.       
  431.       PanoMovie "Direct", gPanoMovieID, "mouseOver"
  432.       -- Result is 0 if you just wandered over the window
  433.       -- without mousing down, if you zoomed in or out without
  434.       -- mousing down, if you used the arrow keys, or if there
  435.       -- was an unhandled event
  436.       put the result into tMouseOverResult
  437.       
  438.       if tMouseOverResult <> 0 then
  439.         put item 1 of tMouseOverResult into tAction
  440.         if tAction = "jump" then
  441.           put item 2 of tMouseOverResult into cast "Current Node ID"
  442.         else if tAction = "stil" then
  443.           put item 2 of tMouseOverResult into cast "Current Hot Spot ID"
  444.         else if tAction = "navg" then
  445.           global gLastPanoMovieData, gPathName
  446.           
  447.           put item 2 of tMouseOverResult into tHotSpotID
  448.           put tHotSpotID into cast "Current Hot Spot ID"
  449.           
  450.           -- We rely on all navigable objects having their all their properties
  451.           -- correctly authored.  It is unclear what will happen if the properties
  452.           -- aren't set up correctly.
  453.           
  454.           put PanoMovie ("Direct", gPanoMovieID, "get", "navgZoomRect") into tStartZoom
  455.           put PanoMovie ("Direct", gPanoMovieID, "get", "navgViewAngles") into tViewAngles
  456.           put PanoMovie ("Direct", gPanoMovieID, "get", "hotSpotName") into tFileName
  457.           
  458.           CollapsePanoMovie
  459.           
  460.           OpenNavMovie gPathName & ":" & tFileName, 2, false
  461.           global gNavMovieID
  462.           if gNavMovieID <> empty then
  463.             -- Remember the last marked frame so we can come back to where we
  464.             -- are now (including proper initialization)
  465.             global gPanoFrame
  466.             put marker(0) into gPanoFrame
  467.             
  468.             -- Show the object controls and take us to the right view of the object
  469.             go to frame "Object From Pano"
  470.             SetNavMovieView item 1 of tViewAngles, item 2 of tViewAngles
  471.             -- Clip the zoom out effect to the movie rect
  472.             put the left of sprite 2 & "," & the top of sprite 2 & "," & ¨
  473. the right of sprite 2 & "," & the bottom of sprite 2 into tClipRect
  474.             ZoomNavMovie tStartZoom, "true", tClipRect
  475.           else
  476.             -- Well, we couldn't open the object, so reupdate the panorama
  477.             PanoMovie ("Direct", gPanoMovieID, "update")
  478.           end if
  479.         else if tAction = "misc" then
  480.           put item 2 of tMouseOverResult into cast "Current Hot Spot ID"
  481.         else if tAction = "undf" then
  482.           put item 2 of tMouseOverResult into cast "Current Hot Spot ID"
  483.         else if tAction = "pan " then   -- Watch out for that space!
  484.           
  485.         end if
  486.         put true into gLastTimeRollover
  487.       else if rollover(pSpriteNum) then
  488.         -- There was an arrow key event or some unhandlable event,
  489.         -- but cursor is still over panoramic window
  490.         put true into gLastTimeRollover
  491.       else
  492.         -- The cursor is no longer over the panoramic window
  493.         
  494.         -- Set the cursor twice because Director tries to be smart and
  495.         -- doesn't change the cursor if your current cursor command
  496.         -- is the same as the last one.  It doesn't realize of course,
  497.         -- that QTVR has changed the cursor in between.
  498.         
  499.         -- KNOWN BUG: It appears that the cursor command is ignored if the mouse
  500.         -- is not over the stage, so if you move out of the movie window
  501.         -- fast enough and off the stage, the cursor will remain unchanged.
  502.         
  503.         cursor 200
  504.         cursor -1
  505.         put false into gLastTimeRollover
  506.       end if
  507.     end if
  508.   else if gLastTimeRollover then
  509.     -- See comment(s) above
  510.     cursor 200
  511.     cursor -1
  512.     put false into gLastTimeRollover
  513.     -- Allow a high quality update in pano window if needed
  514.     if gPanoMovieID <> empty then PanoMovie "Direct", gPanoMovieID, "idle"
  515.   end if
  516. end PanoFrameScript
  517.  
  518.  
  519.  
  520. --=============================================================================
  521. -- Sample PanoMovie callback handler routines
  522. -------------------------------------------------------------------------------
  523.  
  524. --=============================================================================
  525. -- SampleMouseOverHandler
  526. --
  527. -- Called by PanoMovie periodically during mouseOver.
  528. -------------------------------------------------------------------------------
  529. on SampleMouseOverHandler
  530.   put "Mouse over panoramic movie"
  531.   -- If you want to exit from mouseOver, use this line
  532.   global gPanoMovieID
  533.   if gPanoMovieID <> empty then
  534.     --PanoMovie "Direct", gPanoMovieID, "ExitMouseOver" 
  535.   end if
  536. end SampleMouseOverHandler
  537.  
  538. --=============================================================================
  539. -- SampleRolloverHandler
  540. --      pHotSpotID is the id of the hot spot the user is over
  541. --
  542. -- Called by PanoMovie whenever the hot spot the cursor is over changes.
  543. -------------------------------------------------------------------------------
  544. on SampleRolloverHandler pHotSpotID
  545.   put pHotSpotID into cast "Current Hot Spot ID"
  546. end SampleRolloverHandler
  547.  
  548. --=============================================================================
  549. -- SampleMouseDownHandler
  550. --
  551. -- Called by PanoMovie when a mouseDown event occurs during a mouseOver call
  552. -------------------------------------------------------------------------------
  553. on SampleMouseDownHandler
  554.   put "Mouse down during mouseOver call"
  555.   
  556.   global gPanoMovieID
  557.   if gPanoMovieID <> empty then
  558.     PanoMovie "Direct", gPanoMovieID, "PassMouseDown"
  559.   end if
  560. end SampleMouseDownHandler
  561.  
  562. --=============================================================================
  563. -- SamplePanZoomStartHandler
  564. --
  565. -- Called once by PanoMovie when the user starts to pan or zoom.
  566. -------------------------------------------------------------------------------
  567. on SamplePanZoomStartHandler
  568.   put "About to pan or zoom in panoramic movie"
  569. end SamplePanZoomStartHandler
  570.  
  571. --=============================================================================
  572. -- SampleMouseStillDownHandler
  573. --
  574. -- Called by PanoMovie periodically during while the mouse is down within
  575. -- mouseOver or mouseDown.
  576. -------------------------------------------------------------------------------
  577. on SampleMouseStillDownHandler
  578.   put "Enter mouse still down from panoramic movie"
  579.   global gPanoMovieID
  580.   if gPanoMovieID <> empty then
  581.     --put PanoMovie("Direct", gPanoMovieID, "Get", "HPanAngle") into tHPanAngle 
  582.     --put "HPanAngle is currently: " & tHPanAngle
  583.   end if
  584.   put "Leave mouse still down from panoramic movie"
  585. end SampleMouseStillDownHandler
  586.  
  587. --=============================================================================
  588. -- SampleNodeLeaveHandler
  589. --      pToNodeID is the id of the node the user is leaving
  590. --
  591. -- Called by PanoMovie when the user moves between nodes by clicking on link
  592. -- hot spots.
  593. -------------------------------------------------------------------------------
  594. on SampleNodeLeaveHandler pToNode
  595.   put "Jumping to node " & pToNode & " in panoramic movie"
  596. end SampleNodeLeaveHandler
  597.  
  598.  
  599.  
  600.  
  601. --=============================================================================
  602. -- Utility routines
  603. -------------------------------------------------------------------------------
  604.  
  605.  
  606. --=============================================================================
  607. -- ExtractPathName
  608. --      pFileName is the full file path of the file
  609. -- Returns the path component of pFileName
  610. --
  611. -- Extracts and returns the path component of a file specifier.
  612. -------------------------------------------------------------------------------
  613. on ExtractPathName pPathName
  614.   put ":" into tDelimiter
  615.   if pPathName contains tDelimiter then
  616.     put length(pPathName) into tCharPos
  617.     repeat while tCharPos >= 1
  618.       if char tCharPos of pPathName = tDelimiter then return char 1 to tCharPos - 1 of pPathName
  619.       put tCharPos - 1 into tCharPos
  620.     end repeat
  621.     return empty
  622.   else
  623.     return empty
  624.   end if
  625. end ExtractPathName
  626.  
  627.  
  628.  
  629. --=============================================================================
  630. -- XCMD Callback Factory
  631. -------------------------------------------------------------------------------
  632.  
  633.  
  634.  
  635. --=============================================================================
  636. -- CallBackTracer
  637. --
  638. -- As described in "Using Lingo", Appendix A.  Pass any mSendCardMessage
  639. -- commands on to Lingo so that callbacks can be handled.
  640. -------------------------------------------------------------------------------
  641. factory CallBackTracer
  642.   
  643. method mNew
  644.   
  645. method mEvalExpr pExpr
  646.   
  647. method mSendHCMessage pMessage
  648.   
  649. method mSendCardMessage pMessage
  650.   do pMessage
  651.   
  652. method mGetFieldByName pCard, pName
  653.   
  654. method mGetFieldByNum pCard, pNum
  655.   
  656. method mGetFieldByID pCard, pID
  657.   
  658. method mSetFieldByName pCard, pName, pValue
  659.   
  660. method mSetFieldByNum pCard, pNum, pValue
  661.   
  662. method mSetFieldByID pCard, pID, pValue
  663.   
  664. end
  665.  
  666.  
  667.  
  668.  
  669. --=============================================================================
  670. -- Routines used by Pano Callbacks pages
  671. -------------------------------------------------------------------------------
  672.  
  673.  
  674. --=============================================================================
  675. -- SetupHandler
  676. --      pHandlerName is the identifying name of the callback to be set up
  677. --
  678. -- Used to install and de-install callbacks on the Pano Callbacks pages
  679. -------------------------------------------------------------------------------
  680. on SetupHandler pHandlerName
  681.   global gPanoMovieID
  682.   if the hilite of cast (pHandlerName && "Check") then
  683.     PanoMovie "Direct", gPanoMovieID, "set", pHandlerName, "test" & pHandlerName
  684.   else
  685.     PanoMovie "Direct", gPanoMovieID, "set", pHandlerName, empty
  686.   end if
  687. end SetupHandler
  688.  
  689. on TestMouseOverHandler
  690.   global gPanoMovieID
  691.   if gPanoMovieID <> empty then
  692.     put "In mouse over at: " & the ticks into cast "MouseOverHandler Message"
  693.   end if
  694. end TestMouseOverHandler
  695.  
  696. on TestRolloverHotSpotHandler pHotSpotID
  697.   global gPanoMovieID
  698.   if gPanoMovieID <> empty then
  699.     put "Rolling over hot spot: " & pHotSpotID into cast "RolloverHotSpotHandler Message"
  700.   end if
  701. end TestRolloverHotSpotHandler
  702.  
  703. on TestMouseDownHandler
  704.   global gPanoMovieID
  705.   if gPanoMovieID <> empty then
  706.     put "In mouse down at: " & the ticks into cast "MouseDownHandler Message"
  707.     PanoMovie "Direct", gPanoMovieID, "PassMouseDown"
  708.   end if
  709. end TestMouseDownHandler
  710.  
  711. on TestPanZoomStartHandler
  712.   global gPanoMovieID
  713.   if gPanoMovieID <> empty then
  714.     put "In pan zoom start at: " & the ticks into cast "PanZoomStartHandler Message"
  715.   end if
  716. end TestPanZoomStartHandler
  717.  
  718. on TestMouseStillDownHandler
  719.   global gPanoMovieID
  720.   if gPanoMovieID <> empty then
  721.     put "In mouse still down at: " & the ticks into cast "MouseStillDownHandler Message"
  722.     put PanoMovie("Direct", gPanoMovieID, "get", "hpanangle") into cast "MouseStillDownHandler Message"
  723.   end if
  724. end TestMouseStillDownHandler
  725.  
  726. on TestNodeLeaveHandler pToNode
  727.   global gPanoMovieID
  728.   if gPanoMovieID <> empty then
  729.     put "Leaving node ID: " & pToNode into cast "NodeLeaveHandler Message"
  730.   end if
  731. end TestNodeLeaveHandler
  732.  
  733.  
  734.  
  735.  
  736.